#region license
# This file is part of Grawlix.
# 
# Grawlix is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
# 
# Grawlix is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public
# License along with Grawlix.  If not, see
# <http://www.gnu.org/licenses/>.
#endregion

"""Service to resolve game URIs into local URIs."""

namespace Grawlix.Services.Resources
import System

interface IUriResolver:
"""
A service that resolves URIs into more specific URIs.
Remarks: Note that this considered an advanced class only intended to be
	used by those who wish to develop their own resources.
"""
	
	def CompleteUri(uri as Uri) as Uri
	"""
	Completes the given uri with the game scheme.
	Param uri: The URI to complete.
	Returns: A complete URI.
	Remarks: If the original URI is already complete,
		this function will return a copy.
	"""
	
	def Resolve(uri as Uri, allowLocal as bool) as Uri
	"""
	Resolve a URI into a local URI.
	Param uri: The URI to resolve.
	Param allowLocal: Whether to allow local URI schemes,
		such as file:// and internal://.
	Returns: The resolved URI.
	Raises IOException: A generic I/O error occurred.
	Raises FileNotFoundException: The URI could not be resolved.
	Remarks: Note that this is a blocking operation which should only be
		called asynchronously to avoid making the game hang.
	"""
	
	def TryResolve(uri as Uri, allowLocal as bool) as Uri
	"""
	Resolve a URI into a local URI.
	Param uri: The URI to resolve.
	Param allowLocal: Whether to allow local URI schemes,
		such as file:// and internal://.
	Returns: The resolved URI or null if it could not be resolved.
	Raises IOException: A generic I/O error occurred.
	Remarks: Note that this is a blocking operation which should only be
		called asynchronously to avoid making the game hang.
	"""
	
